home *** CD-ROM | disk | FTP | other *** search
- #ifndef __APPHEADER__
- #define __APPHEADER__
-
- #ifndef __DTSLib__
- #include "DTS.Lib.h"
- #endif
-
- #ifndef __PRINTING__
- #include <Printing.h>
- #endif
-
- #ifndef __TREEOBJ__
- #include <TreeObj.h>
- #endif
-
- /********/
-
- #define VH_VERSION 1 /* True means to include ViewHierarchy window. */
- #define DEV_VERSION 1 /* True means allow option-cmd.period escape from dialogs. */
-
- /* If you are unfamiliar with programming with the DTS.framework, you probably want to
- ** read the file "=How to write your app", which is found at the same level as the
- ** directory for this project. */
-
- #ifdef powerc
- #pragma options align=mac68k
- #endif
- typedef struct {
- DocHeaderInfo fhInfo; /* Doc header info (version, print record, window loc. ) */
- TreeObjHndl root;
- /***** Start of custom file info. *****/
- Handle textHndl; /* Temporarily holds opened document text.
- ** The document is first read in, and then a
- ** window is created for it. Until the window
- ** is created, we can't have a TextEdit control.
- ** This field holds the text that was read in
- ** when the file was opened. It is disposed of
- ** after the TextEdit control is created and
- ** holds the document text. */
- StScrpHandle textStyl; /* Same story as textHndl. */
-
- TEHandle inBox; /* TextEdit in-box. */
- TEHandle outBox; /* TextEdit out-box. */
- } TheDoc;
- #ifdef powerc
- #pragma options align=reset
- #endif
-
- /* Below is the master document structure. All DTS.framework documents use this structure.
- ** For each unique document type, union in a sub-structure for the document-specific
- ** information. In the case of AppWannabe, there is only one known document type initially.
- ** The structure for this document type is defined just above. Even though there is only one,
- ** it is still placed in a union. This allows easy addition of additional document types later.
- ** Given a FileRec handle called frHndl, a sample dereference to the inBox field would look like:
- ** inBox = (*frHndl)->d.doc.inBox;
- **
- ** The fileState and connect fields are expected and managed by DTS.framework. Also, the
- ** first two fields in the app-specific portion of the document are expected, namely
- ** the fhInfo and root fields. */
-
- #ifdef powerc
- #pragma options align=mac68k
- #endif
- typedef struct FileRec {
- FileStateRec fileState; /* DTS.Lib expects this structure here. */
- ConnectRec connect; /* DTS.Lib expects this structure here. */
- union {
- TheDoc doc; /* Union in each document type here. */
- } d;
- } FileRec;
- #ifdef powerc
- #pragma options align=reset
- #endif
-
- /* Below is the definition of the hierarchical document's root object. If you are using
- ** the hierarchical document package TreeObj, then you will need at least this object.
- ** TreeObj expects the first two fields to be undo and frHndl, as shown below. You can
- ** add fields after these two fields. If you use TreeObj, the root object and all of its
- ** children are automatically saved and read from disk.
- ** Note that the definition for the root object includes a prototype. Each object is
- ** automatically called by DTS.framework at appropriate times. The prototype defines the
- ** function that will be called for this object. See the files "=How to write your app"
- ** and "=Using TreeObj.c" for more information. */
-
- #ifdef powerc
- #pragma options align=mac68k
- #endif
- long TRootObj(TreeObjHndl hndl, short message, long data);
- typedef struct {
- TreeObjHndl undo; /* This structure may be added to, but */
- FileRecHndl frHndl; /* these two first fields must remain. */
- } RootObj;
- #ifdef powerc
- #pragma options align=reset
- #endif
-
- /********/
-
- #define kMaxNumUndos 64
- #define kNumSaveUndos 8
-
- #define kNumTreeObjs 16 /* Minimum number of objects is 16. */
-
- #define mDerefRoot(hndl) ((RootObj*)((*hndl) + 1))
-
- /********/
-
- /* These values are passed to the DTS.framework function Initialize(). */
- #define kMinHeap 64 * 1024 /* Needs at least 64k of heap space. */
- #define kMinSpace 64 * 1024 /* Needs this much after calling PurgeSpace. */
-
-
- #define kwAppWindow (kwGrowIcon | kwHScrollLessGrow | kwVScrollLessGrow | kwVisible | kwOpenAtOldLoc)
- /* Main application window has growIcon, horizontal and vertical document scrollbars,
- ** is initially visible, and if the document is saved, it will open at the location
- ** it was last closed at. */
-
- #define keyAppMessage 'KMSG' /* Custom Apple Event definitions. */
- #define typeAppMessage 'KMSG'
- #define keyStylMessage 'KSTL'
- #define typeStylMessage 'KSTL'
- #define typeTextMessage 'KTXT'
-
- #define kDisconnectMssg 0
- #define kTextMssg 1
- #define kStylMssg 2
-
- #define kStylResType 'KSTL'
- #define kStylResID 20000
-
- #define kAutoConnectResType 'AUCN'
- #define kAutoConnectResID 20000
-
- #define kVersion 100 /* Document versions, not application versions. */
- #define kMinVersion 100
- #define kMaxVersion 100
-
- #define kMaxNumWindows 65535 /* No limit on the number of windows. */
-
- #endif
-